package com.goods.shop.service.jd;

import com.goods.shop.entity.JDLogs;
import com.goods.shop.mapper.JDLogsMapper;
import com.goods.shop.service.AbstractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class JdLogsServiceImpl extends AbstractService implements JdLogsService {
    @Autowired
    private JDLogsMapper jdLogsMapper;
    @Override
    @Cacheable(value="jdLogsCache")
    public JDLogs findById(int id) {
        Optional<JDLogs> logs= Optional.ofNullable(jdLogsMapper.findById(id));
        logger.info("execute......{}",id);
        return logs.orElse(new JDLogs());
    }

}
